package com.arpa.wms.service.impl;

import com.arpa.ntocc.common.common.util.CommonUtil;
import com.arpa.wms.domain.dto.InitializationItemDTO;
import com.arpa.wms.domain.entity.InitializationItem;
import com.arpa.wms.domain.vo.InitializationItemVO;
import com.arpa.wms.mapper.InitializationItemMapper;
import com.arpa.wms.service.IInitializationItemService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 期初明细 服务 实现类
 * @author jinss
 * @date 2020-09-24 14:35:44
 **/
@Service
public class InitializationItemServiceImpl extends ServiceImpl<InitializationItemMapper, InitializationItem> implements IInitializationItemService {

    @Override
    public List<InitializationItemVO> queryList(InitializationItemDTO initializationItemDTO) {
        //排序字段名需要驼峰转数据库下划线类型字段名
        if(StringUtils.isNotEmpty(initializationItemDTO.getSortField())){
            initializationItemDTO.setSortField(CommonUtil.camel2Underline(initializationItemDTO.getSortField()));
        }
        List<InitializationItemVO> initializationItemList = baseMapper.queryList(initializationItemDTO);
        return initializationItemList;
    }

    @Override
    public InitializationItemVO queryListSum(InitializationItemDTO initializationItemDTO) {
        return this.baseMapper.queryListSum(initializationItemDTO);
    }
}
